/**
 * 用户模型
 */
//连接排班表
const scheduling = require('./SchedulingModel');

const db = require('./index');
const Schema = db.Schema;
const UserSchema = new Schema(
    {
        name: { type: String, require: true },
        sex: { type: String, require: true },
        birthday: { type: String},
        phone: { type: String, require: true },
        post: { type: String, require: true },//岗位属性
        role: { type: String, require: true },//所属角色组
        department: [String],//关联科室
        shop: [String],//关联门店
        jurisdiction: [String],//权限
        commissiontype: { type: String },//提成类型
        commissionproject: { type: String },//提成项目   不同项目用 & 符合分隔开
        commissionratio: { type: Number },//提成比例
        marriage: { type: String },//婚姻状况
        nation: { type: String },//民族
        email: { type: String },//邮件地址
        papers: { type: String },//证件类型
        IDcard: { type: String },//证件号
        synopsis: { type: String },//人员简介
        password: { type: String, require: true },//密码
        logintime: { type: Date, default: Date.now },//登录时间
        state: { type: String },//状态   1:正常使用   2:停止使用  3:冻结

        totreat: { type: Number, default: 0 },//待接诊
        alreadyaccepts: { type: Number, default: 0 },//已接诊

        schedulingmes: { type: Schema.ObjectId, ref: 'Scheduling' },//ref链接排班表
        imgURL: { type: String, default: null }
    }
);
const User = db.model('User', UserSchema);
module.exports = User;



// Schema
// model